import re
import lxml.etree as le

data_s = []

with open('edu.html', 'r', encoding='utf-8') as f:
    html_str = f.read()
    html_str = re.sub('\n', '', html_str)
    # print(html_str)
    html = le.HTML(html_str)
    div_s = html.xpath('//div[@class="classify_cList"]')
    for div in div_s:
        cate1_s = div.xpath('h3/a/text()')
        # print(cate1_s)
        cate2_s = div.xpath('div/span/a/text()')
        # print(cate2_s)
        data_s.append(
            {
                'cate1': cate1_s[0],
                'cate2': cate2_s
            }
        )

for data in data_s:
    print(data['cate1'])
    for cate in data['cate2']:
        print('   ', cate)